<?php echo $this->Html->css(array(
			    'datepicker.css'/*,
			    'Bootstrap.bootstrap-responsive.min.css'*/
			)); ?>
<section class="content-header">
	<h1>Periodo<small> Nuevo</small></h1>
	<ol class="breadcrumb">
		<li>
      <?php echo $this->Html->link(
        $this->Html->tag('i', '', array('class' => 'fa fa-dashboard ')) . "Inicio",'/',   
        array('class' => '', 'escape' => false)
        ); 		
      ?> 
		</li>		
		<li>
      <?php echo $this->Html->link('Periodos',array('controller'=>'members','action'=>'index')  ); 		
      ?> 
		</li>			
		<li class="active">Nuevo</li>
	</ol>
</section>
<?php 
	$option= array(
            'inputDefaults' => array(
                'div' => array(
                	'class' => 'form-group'
                ),
                'label' => array(
                	'class' => ' col-md-push'
                ),
                'between' => '<div class="col-lg-6 right">',
                'seperator' => '</div>',
                'after' => '</div>',
                'class' => 'form-control',
                'error' => array('attributes' => array('wrap' => 'span', 'class' => 'help-block')),
            ),
            'class' => 'form-horizontal box-body',
            'role' => 'form',
        );

	$years=[];
	$current_year=date("Y");
	for($i=$current_year; $i >= ($current_year -20);$i--){
		$years[$i]=$i;
	}
	$concept=array(
		"Enero - Febrero"=>"Enero - Febrero",
		"Marzo - Abril"=>"Marzo - Abril",
		"Enero - Febrero"=>"Enero - Febrero",
		"Enero - Febrero"=>"Enero - Febrero",
		"Marzo - Abril" => "Marzo - Abril",
		"Mayo - Junio"  => "Mayo - Junio",
		"Julio - Agosto"=> "Julio - Agosto",
		"Septiembre - Octubre"=>"Septiembre - Octubre",
		"Noviembre - Diciembre" =>"Noviembre - Diciembre"
		);

	//var_dump($years);
?>
<section class="content">
	<div class="col-xs-8">
		<div class="box box-primary">
      <div class="box-header">
          <h2 class="box-title">Nuevo</h2>
      </div><!-- /.box-header -->
      <!-- form start -->
      <!--<form role="form">
          <div class="box-body">
					</div>
			</form> -->
			<?php echo $this->Form->create('Measures',$option); ?>

				<!-- <?php echo $this->Form->input('year' ,array( 'label' => array( 'text' => __('Código:'),'class' => 'col-lg-3 control-label' ),'options'=>$years))?> -->
				<?php echo $this->Form->input('periods_id' ,array( 'label' => array( 'text' => __('Periodo:'),'class' => 'col-lg-3 control-label' ),'options'=>$periods))?>
				<?php echo $this->Form->input('members_id' ,array( 'label' => array( 'text' => __('Socio:'),'class' => 'col-lg-3 control-label' ),'options'=>$members))?>
				<?php echo $this->Form->input('services_id' ,array( 'label' => array( 'text' => __('Servicio:'),'class' => 'col-lg-3 control-label' ),'options'=>$services))?>
				<!--<?php echo $this->Form->input('interest_rate1' ,array( 'label' => array( 'text' => __('Intereses 1º Vto.:'),'class' => 'col-lg-3 control-label' ),))?> -->
				<?php echo $this->Form->input('control_date' ,array('type'=>'text', 'label' => array( 'text' => __('Fecha Lectura:'),'class' => 'col-lg-3 control-label' )))?>
				<?php echo $this->Form->input('value' ,array('type'=>'text', 'label' => array( 'text' => __('Valor:'),'class' => 'col-lg-3 control-label' )))?>
				<!--
				<?php echo $this->Form->input('interest_rate2' ,array( 'label' => array( 'text' => __('Intereses 1º Vencimiento:'),'class' => 'col-lg-3 control-label' )))?> -->
				
				
      	<div class="form-group hidden">
      		<label class="col-lg-3 control-label" for="PeriodsExperition3">Servicios</label> 
			    <div class="col-lg-6 right">
			    	
	      		<?php foreach ($services as $item):?>
	      			<label class="checkbox">            
	      				<input type="checkbox" value="<?php echo $item['Services']['id'];?>" id="inlineCheckbox1" checked> <?php echo $item['Services']['name'];?> - <?php echo $item['Services']['unit_price'];?>$
			        </label>
	      		<?php endforeach;?>
					</div>
				</div>

				<div class="form-group">
			    <div class="col-sm-offset-2 col-sm-10">
			      <button type="submit" class="btn btn-info btn-flat">Guardar</button>
			      <?php echo $this->Html->link(__('Cancelar', true), array('controller' => 'members', 'action' => 'index' ),array('class'=>'btn btn-info btn-flat')); ?> 
			    </div>
			  </div>
			<?php echo $this->Form->end();?>
		</div>
	</div>
</section>
<?php 
		echo $this->Html->script(array(
    'bootstrap-datepicker.js'
		));
	?>
<script type="text/javascript">

	
	$(function(){

		$("#MeasuresControlDate").datepicker({
    	format: "dd-mm-yyyy"
		});		

	});
</script>